// TerminalDataManager.cpp: implementation of the CTerminalDataManager class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "GameNetManager.h"
#include "TerminalDataManager.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CTerminalDataManager* CTerminalDataManager::m_pInstance=NULL;
CTerminalDataManager::CTerminalDataManager()
{

}

CTerminalDataManager::~CTerminalDataManager()
{
	if(m_pInstance!=NULL)
	{
		delete m_pInstance;
		m_pInstance=NULL;
	}
}

CTerminalDataManager* CTerminalDataManager::CreateInstance()
{ 
	if(m_pInstance==NULL)
	{
		m_pInstance=new CTerminalDataManager();
	}
	return m_pInstance;
} 

BOOL CTerminalDataManager::ClearTerminal()
{
	int iCount=m_arrTerminal.GetSize();
	for(int i=0;i<iCount;i++)
	{
		lpTerminalInfo pTerminal=m_arrTerminal.GetAt(i);
		if(pTerminal==NULL) continue;
		delete pTerminal;
		pTerminal=NULL;
	}
	m_arrTerminal.RemoveAll();
	return TRUE;
}

BOOL CTerminalDataManager::AddItem(lpTerminalInfo pTerminal)
{
	if(pTerminal==NULL) return FALSE;
	m_arrTerminal.Add(pTerminal);
	return TRUE;
} 
